Skip to content

add AYON_CERT_FILE to try server request#248

Closed
jm22dogs wants to merge 2 commits intoynput:developfrom
jm22dogs:develop
Closed

add AYON_CERT_FILE to try server request#248
jm22dogs wants to merge 2 commits intoynput:developfrom
jm22dogs:develop

Conversation

@jm22dogs
Copy link

Changelog Description

When the Ayon Launcher tests the server url before login, the AYON_CERT_FILE env var is not passed to the get requests that pings the server, and fails even if there is a custom self signed cert pointed in that var AYON_CERT_FILE.
This PR simply adds that env var to the verify kwarg in the requests.get method.

@BigRoy BigRoy requested a review from iLLiCiTiT April 29, 2025 15:51
@BigRoy BigRoy added type: bug Something isn't working community labels Apr 29, 2025
# TODO add validation if the url lead to AYON server
# - this won't validate if the url lead to 'google.com'
requests.get(url, timeout=timeout)
requests.get(url, timeout=timeout, verify=os.getenv("AYON_CERT_FILE"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requests.get(url, timeout=timeout, verify=os.getenv("AYON_CERT_FILE"))
requests.get(
url, timeout=timeout, verify=os.getenv("AYON_CERT_FILE")
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at ServerAPI which does something like this:

ssl_verify = os.environ.get("AYON_CA_FILE") or True
cert = os.environ.get("AYON_CERT_FILE")
requests.get(
    url, timeout=timeout, verify=ssl_verify, cert=cert
)

Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
@MustafaJafar MustafaJafar requested a review from iLLiCiTiT April 29, 2025 16:39
Comment on lines +332 to +334
requests.get(
url, timeout=timeout, verify=os.getenv("AYON_CERT_FILE")
)
Copy link
Member

@iLLiCiTiT iLLiCiTiT May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The verify argument is used to "check for ssl certificates" (and you can specify file with custom CA authority), using "standard CA authorities" when set to True, and cert is used to define custom path validated against CA authority.

Suggested change
requests.get(
url, timeout=timeout, verify=os.getenv("AYON_CERT_FILE")
)
ssl_verify = os.environ.get("AYON_CA_FILE") or True
cert = os.environ.get("AYON_CERT_FILE") or None
requests.get(
url, timeout=timeout, verify=ssl_verify, cert=cert
)

@iLLiCiTiT
Copy link
Member

Closing in favor of #249

@iLLiCiTiT iLLiCiTiT closed this May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments